package com.zzg.springboot.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class SpringSecurityController {
	@RequestMapping("/")
	public String index() {
		return "index";
	}

	@RequestMapping("/hello")
	public String hello() {
		return "hello";
	}

	@RequestMapping("/login")
	public String login() {
		return "login";
	}

	@RequestMapping("/403")
	public String error() {
		return "403";
	}

	@PreAuthorize("hasRole('user')")
	@RequestMapping(value = "/admin", method = RequestMethod.POST)
	public String toAdmin() {
		return "helloAdmin";
	}
	

    @RequestMapping("/home")
    public String home() {
        return "home";

    }

}
